<?php

require 'conf.inc.php'; 



function print_list ($array) {
   
    
    $j=0;
    
    global $products;
    //print_r($array);
	
    foreach($array as $item) {
    	
		//print_r($item);  
      $t = $item->type;
      $c = $item->cod;
      //echo $t . $c;
      foreach($products[$t] as $product){
        if($product['id'] == $c) {
            $ident = 'products['. $t .']['. $c .']';
            
          echo '<li class="white" id="'. $ident .'"> <a href="#" data-parm="'. $ident .'">
            <img src="' . $product['image_src'] . '"/>
			<h2 style="white-space:normal;">' . $product['short_description'] . '</h2>' .
            //<p style="white-space:normal;">' . $product['description'] . </p>

            '</a>
            <a href="" data-parm="'. $ident .'" name="deleteProd">Delete</a>
            </li>';
            
        }
          
          }
     
       }
    
   }


  
  
  
  
 $data = json_decode(stripslashes($_POST['products']));
 //print_r($data);
 //echo ($data[0]->type);
 
 print_list($data); 
  


?>








